<?php


namespace app\common\model;


use think\Model;

class Report extends Model
{
    protected $table = 'ic_report';
    protected $autoWriteTimestamp = 'datetime';

    /**
     * 来源:小程序
     */
    const SOURCE_TYPE_XCX = 1;

    /**
     * 来源:百度小程序
     */
    const SOURCE_TYPE_BAIDU_XCX = 2;

    /**
     * 来源:安卓
     */
    const SOURCE_TYPE_ANDROID = 3;

    /**
     * 来源:ios
     */
    const SOURCE_TYPE_IOS = 4;

    /**
     * 来源:h5
     */
    const SOURCE_TYPE_H5 = 5;

    public static function getSourceTextArr($source_type = null)
    {
        $arr = [
            self::SOURCE_TYPE_XCX => '微信小程序',
            self::SOURCE_TYPE_BAIDU_XCX => '百度小程序',
            self::SOURCE_TYPE_ANDROID => '安卓',
            self::SOURCE_TYPE_IOS => 'ios',
            self::SOURCE_TYPE_H5 => 'M端'
        ];
        if (!empty($arr)) return $arr[$source_type] ?? "";
        return array_keys($arr);
    }

    public static function getSourceTextText($source_type)
    {
        $text = self::getSourceTextArr($source_type);
        return is_array($text) ? "" : $text;
    }
}